package com.wteam.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;

@Configuration
public class JacksonConfig {
    @Bean
    public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder){

      com.fasterxml.jackson.databind.ObjectMapper objectMapper=builder.createXmlMapper(false).build();

      //全局配置序列话返回JSON处理
        SimpleModule simpleModule=new SimpleModule();
        //JSON LONG ==>String
  simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
  objectMapper.registerModule(simpleModule);
  return objectMapper;

    }

}
